// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import echarts from 'echarts'
import axios from 'axios'
import qs from 'qs'
import MintUI from 'mint-ui'
import VueAwesomeSwiper from 'vue-awesome-swiper'

// require styles
import 'swiper/dist/css/swiper.css'

Vue.use(VueAwesomeSwiper, /* { default global options } */ )
import 'mint-ui/lib/style.css'
import commonCss from './assets/css/common.css'

Vue.use(MintUI)

Vue.prototype.$echarts = echarts
Vue.prototype.$axios = axios //全局注册，使用方法为:this.$axios
Vue.prototype.qs = qs //全局注册，使用方法为:this.qs
Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
    el: '#app',
    router,
    components: { App },
    template: '<App/>'
})
// 页面title设置
router.beforeEach((to, from, next) => { //beforeEach是router的钩子函数，在进入路由前执行

    if (to.meta.title) { //判断是否有标题

        document.title = to.meta.title

    }

    next() //执行进入路由，如果不写就不会进入目标页

})
export default router